package com.xiaoyu.lanling.feature.chat.viewholder

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.TextView
import com.xiaoyu.lanling.R
import com.xiaoyu.lanling.feature.chat.handler.ChatMessageCallItemClickHandler
import com.xiaoyu.lanling.feature.chat.model.message.ChatMessageReceiveCallItem

class ChatMessageReceiveCallViewHolder : ChatMessageBaseReceiveSendViewHolder<ChatMessageReceiveCallItem>() {
    private var mVoiceLayout: FrameLayout? = null
    private var mTitle: TextView? = null

    override fun doCreateChildrenView(layoutInflater: LayoutInflater, parent: ViewGroup): View? {
        val view = layoutInflater.inflate(R.layout.item_chat_receive_call, parent, false)
        mVoiceLayout = view.findViewById(R.id.chat_message_voice_layout)
        mTitle = view.findViewById(R.id.chat_message_voice_title)
        return view
    }

    override fun showData(position: Int, itemData: ChatMessageReceiveCallItem) {
        super.showData(position, itemData)
        mTitle?.text = itemData.title
        ChatMessageCallItemClickHandler.bindReceiveVoiceItemClickForViewAndData(mVoiceLayout, itemData)
        ChatMessageCallItemClickHandler.bindReceiveVoiceItemLongClickForViewAndData(mVoiceLayout, itemData)
    }
}